package com.lucenten.collect.gnss.entity;

import cn.quevo.common.lang.DateFormatUtils;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class TecpTecl implements Serializable {

    // 台站X
    private Double x;
    // 台站Y
    private Double y;
    // 台站Z
    private Double z;

    // 卫星名称
    private String stratName;
    // 卫星号
    private Integer stratNum;
    // 时间(yyyy/MM/dd HH:mm:ss)
    private String dateTime;
    // 方位角
    private Double azimuth;
    // 仰角
    private Double elevation;
    // TECP（伪距）
    private Double tecp;
    // TECL(相位)
    private Double tecl;
    private String l1;
    private String l2;

    // 卫星X
    private Double xk;
    // 卫星Y
    private Double yk;
    // 卫星Z
    private Double zk;


    public String join() {
        StringBuilder builder = new StringBuilder(DateFormatUtils.format(DateFormatUtils.parse(this.dateTime,"yyyyMMddHHmmss"),"yyyy-MM-dd HH:mm:ss"));
//        builder.append(",").append(this.stratName);
        if (stratName.contains("R")) {
            builder.append(",").append(this.stratNum + 500);
        }else if (stratName.contains("C")) {
            builder.append(",").append(this.stratNum + 700);
        }else {
            builder.append(",").append(this.stratNum);
        }
        builder.append(",").append(this.azimuth);
        builder.append(",").append(this.elevation);
        builder.append(",").append(this.tecp);
        builder.append(",").append(this.tecl);
        builder.append(",").append(this.l1);
        builder.append(",").append(this.l2);

        builder.append(",").append(this.x);
        builder.append(",").append(this.y);
        builder.append(",").append(this.z);

        builder.append(",").append(this.xk);
        builder.append(",").append(this.yk);
        builder.append(",").append(this.zk);
        return builder.toString();
    }
}

